﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Product_Add.aspx.cs" Inherits="Automobile.service.UI.Product_Add" %>

<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,member-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
    <link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
    <link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
    <link href="lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
    <link href="lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
    <!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
    <title>添加用户</title>
</head>
<body>
    <div class="pd-20">
        <form   class="form form-horizontal" id="form-member-add">
            <div class="row cl">
                <label class="form-label col-3"><span class="c-red">*</span>商品名称：</label>
                <div class="formControls col-5">
                    <input type="text" class="input-text" value="" placeholder="请输入商品你名称" id="Product_Name" datatype="*2-16" nullmsg="用户名不能为空">
                </div>
                <div class="col-4"></div>
            </div>
            <div class="row cl">
                <label class="form-label col-3"><span class="c-red">*</span>商品规格</label>
                <div class="formControls col-5 skin-minimal">
                    <input type="text" class="input-text" value="" placeholder="请输入商品规格" id="Product_Modelspe" datatype="*2-16" nullmsg="商品规格不能为空">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-3"><span class="c-red">*</span>商品进价：</label>
                <div class="formControls col-5">
                    <input type="text" class="input-text" value="" placeholder="输入商品进价" id="Product_Bprid" datatype="m" nullmsg="不能为空">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-3"><span class="c-red">*</span>商品售价：</label>
                <div class="formControls col-5">
                    <input type="text" class="input-text" value="" placeholder="输入商品售价" id="Product_Price" datatype="m" nullmsg="不能为空">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-3"><span class="c-red">*</span>商品类别：</label>
                <div class="formControls col-5">
                    <span class="select-box">
                        <select class="select" size="1" name="demo1" datatype="*" nullmsg="请选择商品类别！" runat="server" id="select1">
                            <option value="" selected>-请选择-</option>      
                        </select>
                    </span>
                </div>
                <div class="col-4"></div>
            </div>
            <div class="row cl">
                <label class="form-label col-3"><span class="c-red">*</span>商品编码：</label>
                <div class="formControls col-5">
                    <input type="text" class="input-text" value="" placeholder="输入商品编码" id="Product_Barcode" datatype="m" nullmsg="不能为空">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-3"><span class="c-red">*</span>供货商：</label>
                <div class="formControls col-5">
                    <span class="select-box">
                        <select class="select" size="1" name="demo1" datatype="*" nullmsg="请选择供货商！" runat="server" id="select2">

                        </select>
                    </span>
                </div>
                <div class="col-4"></div>
            </div>  
            
                <label class="form-label col-3"><span class="c-red">*</span>商品备注：</label>
                <div class="formControls col-5">
                    <textarea id="Product_Remark" class="textarea" placeholder="说点什么...最少输入10个字符" datatype="*10-100" dragonfly="true" nullmsg="备注不能为空！" onkeyup="textarealength(this,100)"></textarea>
                    <p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
                </div>
                <div class="col-4"></div>
            </div>
            <div class="row cl">
                <div class="col-9 col-offset-3">
                    <input class="btn btn-primary radius" type="submit" onclick="Add()" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
                </div>
            </div>
        </form>
    <script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="lib/icheck/jquery.icheck.min.js"></script>
    <script type="text/javascript" src="lib/Validform/5.3.2/Validform.min.js"></script>
    <script type="text/javascript" src="lib/layer/1.9.3/layer.js"></script>
    <script type="text/javascript" src="js/H-ui.js"></script>
    <script type="text/javascript" src="js/H-ui.admin.js"></script>
    <script type="text/javascript">
        $(function () {
            $('.skin-minimal input').iCheck({
                checkboxClass: 'icheckbox-blue',
                radioClass: 'iradio-blue',
                increaseArea: '20%'
            });

            $("#form-member-add").Validform({
                tiptype: 2,
                callback: function (form) {
                    form[0].submit();
                    var index = parent.layer.getFrameIndex(window.name);
                    parent.$('.btn-refresh').click();
                    parent.layer.close(index);
                }
            });
        });
        function Add()
        {
            var Product_Name = $("#Product_Name").val();
            var Product_Modelspe = $("#Product_Modelspe").val();
            var Product_Bprid = $("#Product_Bprid").val();
            var Product_Price = $("#Product_Price").val();
            var Product_Type_Id = $("#select1").val();
            if (Product_Type_Id == "-请选择-")
            {
                alert("请选择商品类型");
                return false;
            }
            var Product_Barcode = $("#Product_Barcode").val();
            var Supplier_Id = $("#select2").val();
            if (Supplier_Id == "-请选择-") {
                alert("请选择供货商");
                return false;
            }
            var Product_Remark = $("#Product_Remark").val();
            $.ajax({
                type: "post",
                url: "Hander/AddProduct.ashx",
                data:{
                    Product_Name: Product_Name,
                    Product_Modelspe: Product_Modelspe,
                    Product_Bprid: Product_Bprid,
                    Product_Price: Product_Price,
                    Product_Type_Id: Product_Type_Id,
                    Product_Barcode: Product_Barcode,
                    Supplier_Id: Supplier_Id,
                    Product_Remark: Product_Remark
                },
                success: function (data) {
                    if(data>0)
                    {
                        alert("商品添加成功");
                        parent.location.reload();
                        par.layer.close(parent.layer.getFrameIndex(window.name));
                    }
                },
                error: function () {
                    alert("服务器忙");
                }
            })
        }
    </script>
</body>
</html>
